<div class="col-sm-12 mt20">
  
  <div class="panel" ng-if="dis_state">
    <div class="panel-body">
      <label class="col-sm-3 control-label">优惠名称 : <b>{{discountInfo.name}}</b></label>
      <label class="col-sm-3 control-label">优惠类型 : <b>{{discountInfo.type==1?'打折优惠':'减价优惠'}}</b></label>
      <label class="col-sm-3 control-label">优惠信息 : <b>{{discountInfo.price}}{{discountInfo.type==1?'%':'元'}}</b></label>
    </div>
  </div>

  <div class="panel panel-default">
    <div class="panel-body">
      <div class="col-sm-2">
        <input type="text" class="form-control" placeholder="销售品名称" ng-model="searchform.sale_name">
      </div>
      <div class="col-sm-3">
        <ui-select ng-model="searchform.type" theme="bootstrap">
          <ui-select-match placeholder="请选择优惠类型">{{$select.selected.name}}</ui-select-match>
          <ui-select-choices repeat="item.value as item in discount_type | filter: $select.search">
            <span ng-bind-html="item.name | highlight: $select.search"></span>
          </ui-select-choices>
        </ui-select>
      </div>
      <!-- <div class="col-sm-3">
        <ui-select ng-model="searchform.discount_id" theme="bootstrap" ng-keyup="loadItem($select.search)">
          <ui-select-match placeholder="请输入优惠名称">{{$select.selected.name}}</ui-select-match>
          <ui-select-choices repeat="item.id as item in discount_name | filter: $select.search">
            <span ng-bind-html="item.name | highlight: $select.search"></span>
          </ui-select-choices>
        </ui-select>
      </div> -->
      <div class="col-sm-2">
        <button class="btn btn-info search btn-block" ng-click="search(1)">立即搜索</button>
      </div>
      <div class="col-sm-2">
        <button class="btn btn-info search btn-block" ng-click="addDiscountInfo()">添加优惠产品</button>
      </div>
      
    </div>

    <div class="panel-body">
      <table class="table table-striped table-bordered dataTable table-condensed tree_table">
        <thead>
          <tr>
            <th class="col-md-1 text-center">销售品编号</th>
            <th class="col-md-1 text-center">销售品名称</th>
            <th class="col-md-1 text-center" ng-if="!dis_state">优惠名称</th>
            <th class="col-md-1 text-center">优惠类型</th>
            <th class="col-md-1 text-center">优惠信息</th>
            <th style="width: 5%"></th>
          </tr>
        </thead>
        <tbody>
          <tr ng-repeat="info in list">
            <td class="text-center">{{info.sale_code}}</td>
            <td class="text-center">{{info.sale_name}}</td>
            <td class="text-center" ng-if="!dis_state">{{info.name || '无'}}</td>
            <td class="text-center">{{info.discount_type==1?'打折优惠':'减价优惠'}}</td>
            <td class="text-center">{{info.discount_type==1?info.discount_proportion+'%':info.discount_price+'元'}}</td>
            <td class="text-center">
              <button type="button" class="btn btn-info btn-xs" ng-click="setDiscountInfo(info)">修改</button>
              <button type="button" class="btn btn-danger btn-xs" ng-click="delete($index)">删除</button>
            </td>
          </tr>
        </tbody>
      </table>
    </div>

    <div class="text-right" style="background-color: white; margin-right: 30px">
      <pagination total-items="totalItems" ng-model="currentPage" ng-change="search()" previous-text="上一页"
        next-text="下一页" first-text="首页" last-text="尾页" max-size="5" boundary-links="true" rotate="false"
        items-per-page="itemsPerPage" class="m-t-none m-b"></pagination>
    </div>

  </div>
</div>